// IterationTemplate.h: interface for the IterationTemplate class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_ITERATIONTEMPLATE_H__AE9A912A_C20B_4F5F_9029_D650ABE9D74D__INCLUDED_)
#define AFX_ITERATIONTEMPLATE_H__AE9A912A_C20B_4F5F_9029_D650ABE9D74D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "smallobject.h"

template
<
typename Input, 
typename Output = Input
> 
class IteratorTemplate : public SmallObject 
{
protected:
	typedef Input DataType;
	typedef Output OutputType;

public:
	IteratorTemplate(){m_bState = TRUE;}

public:
	virtual ~IteratorTemplate(){}

	
public:
	virtual void Begin() = 0;
	virtual void Next() = 0;
	virtual BOOL End(){return m_bState;}

	virtual Output Get(){
		return (Output)m_Data;
	}

protected:
	void SetData(DataType Data){
		if(Data != NULL)
		{
			m_Data = Data;
			m_bState = FALSE;
		}
		else
		{
			m_Data = NULL;
			m_bState = TRUE;
		}
	}

private:
	DataType m_Data;
	BOOL m_bState;
};


#endif // !defined(AFX_ITERATIONTEMPLATE_H__AE9A912A_C20B_4F5F_9029_D650ABE9D74D__INCLUDED_)
